package cn.bellychang.leetcode.question344;

/**
 * @author ChangLiang
 * @date 2021/3/16
 */
public class Solution {

    public void reverseString(char[] s) {

        int i = 0;
        int j = s.length - 1;
        while (i < j) {
            swap(i, j, s);
            i++;
            j--;
        }
    }

    private void swap(int i, int j, char[] s) {
        char temp = s[i];
        s[i] = s[j];
        s[j] = temp;
    }
}
